#include "basemodel.h"

BaseModel::BaseModel(QObject *parent) :
    QObject(parent)
{
    _updateRate = 0;
    _lastUpdateTimestamp = 0;
}

/*
  getUpdateRate

  Desc - Returns the rate at which the model is being updated with information
         from the connection
  */
int BaseModel::getUpdateRate()
{
    return _updateRate;
}

/*
  getConnectionStatus

  Desc - Gets the connection status of the connection to the device
  */
GCSCommon::ConnectionStatus BaseModel::getConnectionStatus()
{
    return getConnection()->getConnectionStatus();
}


// slots

/*
  passOnPingTestResults

  Desc - Passes on the result of a pingThread ping test. Called by the pingThread
  */
void BaseModel::passOnPingTestResults(int pingResult)
{
    emit pingTestCompleted(pingResult);
}

/*
  runPingTest

  Desc - Runs a ping test to the device's address. The result is returned via
         a signal from a thread.
  */
void BaseModel::runPingTest()
{
    getConnection()->runPingTest();
}
